﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace EF.Models
{
    public partial class ninestarContext : DbContext
    {
        public ninestarContext()
        {
        }

        public ninestarContext(DbContextOptions<ninestarContext> options)
            : base(options)
        {
        }

        public virtual DbSet<Memberuser> Memberuser { get; set; }
        public virtual DbSet<Parenttree> Parenttree { get; set; }
        public virtual DbSet<Systemlog> Systemlog { get; set; }
        public virtual DbSet<Systemusers> Systemusers { get; set; }
        public virtual DbSet<Upgradeapply> Upgradeapply { get; set; }
        public virtual DbSet<Userlog> Userlog { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                optionsBuilder.UseMySQL("Database='ninestar';Data Source='127.0.0.1';User Id='root';Password='123456';charset='utf8';pooling=true");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.HasAnnotation("ProductVersion", "2.2.1-servicing-10028");

            modelBuilder.Entity<Memberuser>(entity =>
            {
                entity.ToTable("memberuser", "ninestar");

                entity.Property(e => e.Id)
                    .HasColumnName("id")
                    .HasColumnType("int(11)");

                entity.Property(e => e.InviteCode)
                    .HasColumnName("inviteCode")
                    .HasMaxLength(16)
                    .IsUnicode(false);

                entity.Property(e => e.IsSystem)
                    .HasColumnName("isSystem")
                    .HasColumnType("int(11)");

                entity.Property(e => e.LastLoginDate).HasColumnName("lastLoginDate");

                entity.Property(e => e.Mobile)
                    .HasColumnName("mobile")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.Pwd)
                    .HasColumnName("pwd")
                    .HasMaxLength(40)
                    .IsUnicode(false);

                entity.Property(e => e.Realname)
                    .HasColumnName("realname")
                    .HasMaxLength(40)
                    .IsUnicode(false);

                entity.Property(e => e.RecommUserid)
                    .HasColumnName("recommUserid")
                    .HasColumnType("int(11)");

                entity.Property(e => e.RegDate).HasColumnName("regDate");

                entity.Property(e => e.StarLevel)
                    .HasColumnName("starLevel")
                    .HasColumnType("int(11)");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)");

                entity.Property(e => e.Weixin)
                    .HasColumnName("weixin")
                    .HasMaxLength(100)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Parenttree>(entity =>
            {
                entity.ToTable("parenttree", "ninestar");

                entity.Property(e => e.Id)
                    .HasColumnName("id")
                    .HasColumnType("int(11)");

                entity.Property(e => e.FloorLevel)
                    .HasColumnName("floorLevel")
                    .HasColumnType("int(11)");

                entity.Property(e => e.ParentUserid)
                    .HasColumnName("parentUserid")
                    .HasColumnType("int(11)");

                entity.Property(e => e.Userid)
                    .HasColumnName("userid")
                    .HasColumnType("int(11)");
            });

            modelBuilder.Entity<Systemlog>(entity =>
            {
                entity.ToTable("systemlog", "ninestar");

                entity.Property(e => e.Id)
                    .HasColumnName("id")
                    .HasColumnType("int(11)");

                entity.Property(e => e.Cont)
                    .HasColumnName("cont")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.LogType)
                    .HasColumnName("logType")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.OpDate).HasColumnName("opDate");

                entity.Property(e => e.OpIp)
                    .HasColumnName("opIp")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.Userid)
                    .HasColumnName("userid")
                    .HasColumnType("int(11)");
            });

            modelBuilder.Entity<Systemusers>(entity =>
            {
                entity.ToTable("systemusers", "ninestar");

                entity.Property(e => e.Id)
                    .HasColumnName("id")
                    .HasColumnType("int(11)");

                entity.Property(e => e.LastLoginDate).HasColumnName("lastLoginDate");

                entity.Property(e => e.LastLoginIp)
                    .HasColumnName("lastLoginIp")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.Pwd)
                    .HasColumnName("pwd")
                    .HasMaxLength(40)
                    .IsUnicode(false);

                entity.Property(e => e.RealName)
                    .HasColumnName("realName")
                    .HasMaxLength(40)
                    .IsUnicode(false);

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)");

                entity.Property(e => e.UserName)
                    .HasColumnName("userName")
                    .HasMaxLength(100)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Upgradeapply>(entity =>
            {
                entity.ToTable("upgradeapply", "ninestar");

                entity.Property(e => e.Id)
                    .HasColumnName("id")
                    .HasColumnType("int(11)");

                entity.Property(e => e.ApplyDate).HasColumnName("applyDate");

                entity.Property(e => e.ApplyStarLevel)
                    .HasColumnName("applyStarLevel")
                    .HasColumnType("int(11)");

                entity.Property(e => e.CheckDate).HasColumnName("checkDate");

                entity.Property(e => e.CheckDate2).HasColumnName("checkDate2");

                entity.Property(e => e.CheckUserid)
                    .HasColumnName("checkUserid")
                    .HasColumnType("int(11)");

                entity.Property(e => e.CheckUserid2)
                    .HasColumnName("checkUserid2")
                    .HasColumnType("int(11)");

                entity.Property(e => e.NowStarLevel)
                    .HasColumnName("nowStarLevel")
                    .HasColumnType("int(11)");

                entity.Property(e => e.Status)
                    .HasColumnName("status")
                    .HasColumnType("int(11)");

                entity.Property(e => e.Status2)
                    .HasColumnName("status2")
                    .HasColumnType("int(11)");

                entity.Property(e => e.Userid)
                    .HasColumnName("userid")
                    .HasColumnType("int(11)");
            });

            modelBuilder.Entity<Userlog>(entity =>
            {
                entity.ToTable("userlog", "ninestar");

                entity.Property(e => e.Id)
                    .HasColumnName("id")
                    .HasColumnType("int(11)");

                entity.Property(e => e.Cont)
                    .HasColumnName("cont")
                    .HasMaxLength(1000)
                    .IsUnicode(false);

                entity.Property(e => e.LogType)
                    .HasColumnName("logType")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.OpDate).HasColumnName("opDate");

                entity.Property(e => e.OpIp)
                    .HasColumnName("opIp")
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.UserId)
                    .HasColumnName("userId")
                    .HasColumnType("int(11)");
            });
        }
    }
}
